<!DOCTYPE html>
<html>
<head>
    <title></title>
    <meta name="keywords" content=""/>
    <meta name="description" content="">
    <include file="public@head"/>
</head>

<body class="body-white">


<div class="container tc-main">
    <div class="row">
        <div class="col-md-4 col-md-offset-4">
            <h2 class="text-center">恒道内部资料系统注册</h2>
            <notempty name="theme_vars.enable_mobile">
                <ul class="nav nav-tabs nav-justified" id="myTab" style="margin-bottom: 15px;">
                    <li class="active"><a href="#email" data-toggle="tab">邮箱注册</a></li>
                </ul>
            </notempty>

                <div class="tab-pane"  id="email">
                    <form class="js-ajax-form" action="{:url('user/register/doRegister')}" method="post">
                        <div class="form-group">
                            <input type="text" name="username" placeholder="姓名" class="form-control">
                        </div>
                        <div class="form-group">
                            <input type="password" name="password" placeholder="密码" class="form-control">
                        </div>
                        <div class="form-group">
                                <input type="text" name="username" placeholder="邮箱" class="form-control">
                        </div>
                        <div class="form-group">
                            <span class="select-box" style="width:100px;">
                            <select name="" class="select" id="project_res" size="1">   
                                <option value="0">选择职位</option>  
                                <option value="1">员工</option>  
                                <option value="2">总监</option>  
                                <option value="3">总经理</option>  
                            </select>
                            </span>
                            <select name="" class="select" id="bankuai" size="1">
                                <option value="0">选择板块</option>   
                                <option value="1">齐创集团</option>
                                <option value="2">宏泰板块</option>
                                <option value="3">百分电子</option>
                                <option value="4">将相教育</option>
                                <option value="5">爱辰防护</option>
                                <option value="6">十步科技</option>
                                <option value="7">见科智能</option>
                                <option value="8">京急便科技</option>
                            </select>
                            <span class="select-box" style="width:100px;">
                            <select name="" class="select" id="project_res" size="1">   
                                <option>选择项目</option>  
                            </select>
                            </span>
                        </div>
                        <div class="form-group">
                            <button class="btn btn-primary btn-block js-ajax-submit" type="submit" data-wait="1500"
                                    style="margin-left: 0px;">确定注册
                            </button>
                        </div>

                        <div class="form-group" style="text-align: center;">
                            <p>
                                已有账号? <a href="{:cmf_url('user/Login/index')}">点击此处登录</a>
                            </p>
                        </div>
                    </form>

                </div>

        </div>
    </div>

</div>
<!-- /container -->

<include file="public@scripts"/>
<script type="text/javascript">

    /*
    **根据板块查出板块下的分公司及项目
    *author : Rain
    */
    $('#bankuai').change(function(){
        $.ajax({
            type:"post",
            url:"{:url('SortMat/plateBelow')}",
            data:'bankuai='+$('#bankuai').val(),
            dataType:"json",
            success:function(data){
                alert(data);return false;
                //console.log(data);
                $("#company_res").empty(data.regional_arr);
                $("#project_res").empty(data.project_res);
                var obj = eval(data.regional_arr);//接收json 数据并进行对象化
                $("#company_res").html("<option disabled selected value=''+>选择分公司</option>");
                $("#project_res").html("<option disabled selected value=''+>选择项目</option>");
                $(obj).each(function(index){
                  //将接受过来的数据填充到下拉列框中
                  var val=obj[index];
                  $('#company_res').append('<option value='+val+'>'+val+'</option>');  
                });
                var obj = eval(data.project_arr);//接收json 数据并进行对象化
                
                $(obj).each(function(index){
                  //将接受过来的数据填充到下拉列框中
                  var val=obj[index];
                  $('#project_res').append('<option value='+val+'>'+val+'</option>');
                });
            }
        });
        
    });
    
    $('#startSearch').click(function(){
      bankuai = $('#bankuai').val(); //板块名
      start_time = $('#countTimestart').val(); //开始时间
      end_time = $('#countTimeend').val(); //结束时间
      company_res = $('#company_res').val(); //分公司名
      project_res = $('#project_res').val(); //项目名
      entry_mode = $('#entry_mode').val(); //录入方式
      if(
        bankuai == null || bankuai == undefined || bankuai == ""  ||
        start_time == null || start_time == undefined || start_time == ""  ||
        end_time == null || end_time == undefined || end_time == ""  
      ){
        alert("不能为空哦！");
        return false;
      }
    
      $.ajax({
        type:"post",
        url:"{:url('SortMat/searchNeeded')}",
        data:{
            'bankuai' : bankuai,'start_time' : start_time,'end_time' : end_time,
            'company_res' : company_res,'project_res' : project_res,'entry_mode' : entry_mode,
        },
        dataType:"json",
        success:function(data){
          $("#source_list").empty(data);
          if(data == null || data == undefined || data == ""){
            alert('该板块暂无数据,请重新选择其它板块!!!');return false;
          }
          if(data == 'error'){
            alert('条件不成立,请重新选择条件!!!'); return false;
          }
          var obj = eval(data);//接收json 数据并进行对象化
          $(obj).each(function(index){
            //将接受过来的数据填充到下拉列框中
            var val=obj[index];
            $('#source_list').append('<td>'+val+'</td>');  
          });
        }
      });
    });
    
    $('#phoneButt').click(function(){
      phone = $('#phone').val(); //手机号
    
      if(phone == null || phone == undefined || phone == ""){
        alert("不能为空哦！");
        return false;
      }
    
      var vali=/[1][0-9][0-9]{9}/;
          if(vali.test(phone) == false){
            alert("手机号格式错误");return false;
          }
    
      $.ajax({
        type:"post",
        url:"{:url('SortMat/phoneSele')}",
        data:{
            'phone' : phone,
        },
        dataType:"json",
        success:function(data){
          $("#phone_list").empty(data);
          if(data == null || data == undefined || data == ""){
            alert('该手机号暂无数据,请重新输入手机号!!!');return false;
          }
          if(data == 'error'){
            alert('条件不成立,请重新选择条件!!!'); return false;
          }
          var obj = eval(data);//接收json 数据并进行对象化
          $(obj).each(function(index){
            //将接受过来的数据填充到下拉列框中
            var val=obj[index];
            $('#phone_list').append('<tr class="text-c">'+val+'</tr>');  
          });
        }
      });
    });
    
</script> 
</body>
</html>